package com.jsmy.marketing.activity;

import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;

import com.jsmy.marketing.R;
import com.jsmy.marketing.base.BaseActivity;
import com.jsmy.marketing.utils.WebUtil;

import butterknife.BindView;

public class WebActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.webView)
    WebView mWeb;
    @Override
    protected int resId() {
        return R.layout.activity_web;
    }

    @Override
    protected void initData() {
        toolbar.setTitle("");
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        mTvTitle.setText(getPrevExtras().getString("title"));
        String url=getPrevExtras().getString("url");
        WebUtil.instance().setWV(mWeb, TextUtils.isEmpty(url)?"https://www.baidu.com/":url, new WebUtil.OnWebProgressListener() {
            @Override
            public void onWebProgressStart() {

            }

            @Override
            public void onWebProgressFinish() {

            }

            @Override
            public void onWebTittleChange(String title) {

            }
        });
    }

    @Override
    public void refreshData(Object object, String api_id) {

    }
}
